package cn.pconline.autoclub.util.ubb;

import java.util.LinkedList;

/**
 *
 * @author xhchen
 */
public class RootNode implements Node {
	StringBuilder text = new StringBuilder();
    StringBuilder imgText = new StringBuilder();//专门存放imgNode的内容，为了审核的图文分开
	@Override
	public String getName() {
		return "__ubb__";
	}

	@Override
	public String getAttribute() {
		return null;
	}

	@Override
	public StringBuilder getText(java.util.LinkedList<Node> stack) {
		return text;
	}

	@Override
	public StringBuilder getText() {
        return text;
	}

    @Override
    public StringBuilder getImgText(LinkedList<Node> stack) {
        return imgText;
    }

    @Override
    public StringBuilder getImgText() {
        return imgText;
    }

	@Override
	public void appendText(CharSequence text) {
		EscapeUtils.appendHtml(text, this.text);
	}

	@Override
	public void appendNode(Node node, java.util.LinkedList<Node> stack) {
        this.text.append(node.getText(stack));
	}

    @Override
    public void appendImgNode(Node node, LinkedList<Node> stack) {
        this.imgText.append(node.getImgText(stack));
    }

	@Override
	public Node copyWithoutText() {
		return null;
	}

	@Override
	public Node build(String name, String attribute) {
		return new RootNode();
	}
}
